package collection;

import org.junit.Test;

import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;

/**
 * @author lwmzzz
 * @version 1.0
 * @date 2021/4/1 0:26
 * @description set类
 */
public class SetTest {

    @Test
    public void test() {
        Set<Integer> set = new HashSet<>();
        set.add(1);
        set.add(2);
        set.add(3);
        set.add(null);
        System.out.println(set);
        Set<Integer> set1 = new HashSet<>();
        set1.add(1);
        System.out.println(set.equals(set1));
        System.out.println(set.hashCode());
        System.out.println(set1.hashCode());
    }

    @Test
    public void test1() {
        Set set = new LinkedHashSet();
        set.add("1");
    }
}
